Repository navigation
fix(skills): measure seam-gate speed-match on the frame grid - #7396
PaprikaChen wants to merge 1 commit into
Conversation
|
@jrusso1020 thanks for confirming the approach on #7021! Could you approve the workflow runs when you get a chance? The CI jobs are waiting on fork approval. |
5627c41 to
d556960
Compare
|
Rebased onto #7454's async seek. The frame-grid sampling now goes through the awaited |
d556960 to
caf4506
Compare
jrusso1020
left a comment
There was a problem hiding this comment.
REQUEST_CHANGES at caf4506f, for one non-code reason: the commit is unsigned. This repo's main ruleset requires signed commits, so the PR stays blocked even with approvals and green CI, and the merge queue's squash doesn't fix that. Please re-push it signed, for example git commit --amend --no-edit -S then git push --force-with-lease, from an email linked to your GitHub account. I'll approve the new head, provided the content is unchanged. The code itself is ready:
- Root cause is right. The player floors every seek to the frame grid.
quantizeTimeToFrameusesMath.floor(t·fps + 1e-9). Socut ± k/fpssamples for an off-grid cut shift both exit samples up to a frame early and put the first entry sample on the cut. That under-reads the exit and over-reads the entry, which matches the 1.67 / 3.51 ratios in the table. - The fix samples whole frames. It samples at
(cutFrame − win)/fps … (cutFrame + win)/fps. Exactly the same frames as before for on-grid cuts. I checked thatf/fpsalways lands back on framefunder the player's+1e-9floor. Without that epsilon, 1,953 frames across 24, 25, 30 and 60 fps would fall a frame short, so the epsilon matters and is already there.cutFrame − 1stays before the cut andcutFrame + 1after it, so zero-overlap and carrier keep their meaning. cut-gridis a WARN, so the gate's exit code is unchanged. The "less than half a frame rounds to the same frames as before" limit is stated honestly.- Docs.
seam-gate.mdand cut-the-curve §3 now say speed-match compares window averages. Keeping the stamp defaults is backed by the mirrored-ease = 1.00 measurement..agents/and.claude/are mirrored identically, and CI is green (26 pass).
Nit (non-blocking): win = round(0.1·fps) and cutFrame assume the ledger's fps matches the composition. The doc line now says so. A one-line WARN when ledger.fps is missing, so the gate falls back to its default, would catch a 24 fps film measured on a 30 fps grid.
Need ✅ · Size ✅ (+66/−14) · Reuse ✅ (the player's own frame grid) · Simpler ✅
Risk: very low. It changes the skill script and docs only.
— Rames
The player floors every seek to a frame, so sampling an off-grid cut at cut - 0.1 / cut - 1f / cut + 1f / cut + 0.1 shifts both exit samples up to a frame early and puts the first entry sample on the cut itself. Exit is under-read, entry over-read: with the stamped defaults a cut just under a frame past the grid scores 1.67 (x/y) and 3.5 (z) instead of 0.82 / 1.09. Sample whole frames placed symmetrically around the nearest frame, warn with a cut-grid row when the cut is off the grid, and document in seam-gate.md and cut-the-curve section 3 that speed-match compares window averages. Grid-aligned cuts sample the same frames as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
caf4506 to
7df5094
Compare
|
Re-pushed signed, content unchanged. Thanks for the review! |
What
seam-gate.mjsnow samples speed-match (and the checks that share its samples) on whole frames placed symmetrically around the nearest frame to the cut. It adds acut-gridWARN row when a ledgercutsits between frames.references/seam-gate.mdand cut-the-curve §3 now say that speed-match compares window averages, not the instantaneous velocity at the cut. The stamp defaults are unchanged.Why
The player floors every seek to the frame grid (
quantizeTimeToFrameinpackages/core/src/inline-scripts/parityContract.ts). The gate sampled atcut - 0.1,cut - 1f,cut + 1f,cut + 0.1. Whencutfalls between two frames, both exit samples land up to a frame early and miss the fastest part of the exit, while the first entry sample lands on the cut itself, at the fastest part of the entry. Exit is under-read and entry is over-read, which produces the 1.70 / 3.7 ratios in the issue.Measured on a 7-scene / 6-seam 1080×1080 film (↓ ← ↑ → z+ z−), stamp defaults, current
main:The issue's other observations also come from this off-grid sampling, not from the stamp durations:
power4.in/power4.out(andexpo.in/expo.out) with matched travel and duration read exactly 1.00, because the two windows are symmetric. The issue measured 2.60 / 3.84 for the same setup.Related work
Fixes #7021. The root cause and data are also in a comment on the issue. The maintainer's original plan was to change the stamp defaults instead; if you'd still prefer that, I'm happy to update this PR.
How
cutFrame = Math.round(cut * fps). The four sample times are integer frames:cutFrame - win,cutFrame - 1,cutFrame + 1,cutFrame + win, withwin = round(0.1 * fps). For an on-grid cut these are the same frames as before. For an off-grid cut,cutFrame - 1is still before the cut andcutFrame + 1still after it, so zero-overlap and carrier keep their meaning.cut-gridis a WARN, so the gate's exit code is unchanged (it fails only on FAIL rows).cut-gridinstead of compensating for it..agents/skillsand.claude/skillsare updated together.Test plan
Built the test film above. For each cut offset and duration variant I stamped it with
seam-stamp.mjs --write, ranseam-gate.mjs verify --json, and compared the ratios before and after. With the change, every other row (ledger, exit/entry vector, zero-overlap, z-sign-scan) still PASSES at every offset.node scripts/check-skill-mirror.mjs,node scripts/check-comment-citations.mjs,node scripts/comment-ratchet.mjs, oxlint and oxfmt on the changed files: all pass.Unit tests added/updated (the skill scripts have no test harness; verified with the film above)
Manual testing performed
Documentation updated (if applicable)
Comments follow CONTRIBUTING.md "Comments": they say why, not what, and a bug fix says what the code must do and how to reproduce the bug
🤖 Generated with Claude Code